package com.wocao.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wocao.entity.ReqBody;
import com.wocao.entity.ResponseResult;
import com.wocao.entity.ZyCommunityInteraction;
import com.wocao.service.ZyCommunityInteractionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 社区互动表 前端控制器
 */
@RestController
@RequestMapping("/interaction")
public class ZyCommunityInteractionController {

    @Autowired
    private ZyCommunityInteractionService interactionService;

    //查询+搜索
    @PostMapping("/s/{current}")
    public ResponseResult<Page<ZyCommunityInteraction>> allPage(@PathVariable int current, @RequestBody ReqBody reqBody) {
        Page<ZyCommunityInteraction> page = interactionService.allPage(new Page<>(current, reqBody.getSize()), reqBody);
        return ResponseResult.ok(page);
    }

    //删除
    @PostMapping("interaction")
    public ResponseResult remove(@RequestBody ZyCommunityInteraction interaction){
        interactionService.updateById(interaction);
        return ResponseResult.ok();
    }


}
